
import { getCurrentInstance, onMounted, nextTick, ref } from 'vue'
// 列表滚动高度
export const useTableScroll = (params: {
  pageHeight?: number;
  headerHeight?: number,
  headerNumber?: number
} = {}) => {
  // const { pageHeight = 56, headerHeight = 47 } = params;

  let tabHeight = ref<string>('250px')
  // const { proxy } = getCurrentInstance();
  
  // function calcH() {
  //   const el = proxy.$el.parentElement || null;
  //   if(el) {
  //     const tabContent: HTMLElement = el.querySelector(".u-table-content");
  //     if(tabContent) {
  //       const tHead: HTMLElement = tabContent.querySelector('.ant-table-header')
  //       if(!tHead) {
  //         setTimeout(() => calcH(), 250)
  //       }
  //       let tableH = tHead ? (tHead?.clientHeight || 0) : headerHeight
  //       let tH = tabContent.clientHeight - pageHeight - tableH
  //       tabHeight.value = tH.toString() + 'px'
  //     }
  //   }
  // }

  // nextTick(() => calcH())

  // onMounted(() => {
  //   setTimeout(() => calcH(), 500)
  // })

  return tabHeight;
}
